package com.yanqu.road.server.timer.beautyescort;

import com.yanqu.road.server.manager.beautyescort.CrossBeautyEscortMgr;
import com.yanqu.road.server.manager.beautyescort.CrossBeautyEscortRankMgr;
import com.yanqu.road.server.manager.zhaoshang.ZsRankMgr;
import com.yanqu.road.utils.date.DateHelper;
import com.yanqu.road.utils.executor.GeneralTask;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class BeautyEscortCheckTask extends GeneralTask {

    protected Logger logger = LogManager.getLogger(BeautyEscortCheckTask.class.getName());

    private long lastUpdateTime = 0L;

    @Override
    public void doRun() {
        try {
            CrossBeautyEscortMgr.checkAllCartState();
        }catch (Exception e) {
            logger.error("beauty escort cart state check error:", e);
        }


        //启动执行一次
        try {
            if (lastUpdateTime < DateHelper.getTodayZeroTimeStamp()) {
                CrossBeautyEscortRankMgr.removeOutTimeData();
                lastUpdateTime = DateHelper.getTodayZeroTimeStamp();
            }
        }catch (Exception e) {
            logger.error(e.getMessage(), e);
        }

        try {
            CrossBeautyEscortRankMgr.lockPreWeekServerGroup();
        }catch (Exception e) {
            logger.error("beauty escort lockPreWeekServerGroup error:", e);
        }
    }
}
